import { createRouter, createWebHistory } from 'vue-router'
import HomePage from '../views/home/index.vue'
import LoginPage from '../views/login/index.vue'
import UserIndexPage from '../views/user/index.vue'
import UserFormPage from '../views/user/form.vue'
import UserViewPage from '../views/user/view.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: HomePage,
    },
    {
      path: '/login',
      name: 'login',
      component: LoginPage,
    },
    {
      path: '/user',
      name: 'user',
      children: [
        {
          path: 'index',
          name: 'userIndex',
          component: UserIndexPage,
        },
        {
          path: 'form',
          name: 'userForm',
          component: UserFormPage,
        },
        {
          path: 'view',
          name: 'userView',
          component: UserViewPage,
        },
      ],
    },
  ],
})

export default router
